/*    */ package com.hs.activation.common.utils;
/*    */ 
/*    */ import com.hs.activation.common.utils.Aes;
/*    */ import com.hs.activation.common.utils.BaseUtil;
/*    */ import com.hs.activation.common.utils.DateUtil;
/*    */ import com.hs.activation.vo.BlueAreaData;
/*    */ import java.util.Date;
/*    */ import java.util.Random;
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ public final class CodeUtil
/*    */ {
/*    */   private CodeUtil() {
/* 18 */     throw new UnsupportedOperationException("This is a utility class and cannot be instantiated");
/*    */   }
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */   
/*    */   public static String generateCode() {
/* 27 */     StringBuilder code = new StringBuilder();
/* 28 */     Random random = new Random();
/* 29 */     for (int i = 0; i < 20; i++) {
/* 30 */       char s = Character.MIN_VALUE;
/* 31 */       int j = random.nextInt(2);
/* 32 */       switch (j) {
/*    */         case 0:
/*    */         
/*    */         
/*    */         case 1:
/*    */         
/*    */         default:
/*    */           break;
/*    */       } 
/* 41 */       s = (char)(random.nextInt(90) % 26 + 65);
/*    */       
/* 43 */       code.append(s);
/*    */     } 
/* 45 */     return code.toString();
/*    */   }
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */   
/*    */   public static String generateActivation(String computerCode, Long activationSn, Date endTime) {
/* 56 */     BlueAreaData blueAreaData = new BlueAreaData();
/* 57 */     blueAreaData.setRandomCode(generateCode());
/* 58 */     blueAreaData.setActiveSN(activationSn.toString());
/* 59 */     blueAreaData.setMachineCode(computerCode);
/* 60 */     blueAreaData.setEndTime(DateUtil.dateToGmtString(endTime));
/*    */     
/*    */     try {
/* 63 */       return Aes.encrypt(BaseUtil.toJson(blueAreaData));
/* 64 */     } catch (Exception e) {
/* 65 */       e.printStackTrace();
/* 66 */       return "";
/*    */     } 
/*    */   }
/*    */ }


/* Location:              C:\Users\yzc\Desktop\新建文件夹 (3)\activation-0.0.16.jar!\BOOT-INF\classes\com\hs\activation\commo\\utils\CodeUtil.class
 * Java compiler version: 16 (60.0)
 * JD-Core Version:       1.1.3
 */